package com.easy.controller;

import com.easy.bean.Admin;
import com.easy.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("admin")
@CrossOrigin
public class AdminController {

    @Autowired
    private AdminService adminService;

    @RequestMapping("list")
    public List<Admin> getList() {
        // 直接返回服务层获取的列表，不需要成员变量
        return adminService.list();
    }
}